package com.example.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author fyx
 * ControllerAdvice 声明为通知
 */
@ControllerAdvice
public class GlobalException {
    @ExceptionHandler()
    @ResponseBody
    public String handlerException(Exception e){
        return "服务器正在维护："+e.getMessage();
    }
}
